import $service from '../../../../../service';
const app = getApp()
let params = {
  size: 10,
  current: 1
}
let isLoading = true
Page({
  data: {
    list: []
  },

  onLoad() {
    this.queryTransactionListPage()
  },
  queryTransactionListPage() {
    app.http.queryTransactionListPage(params).then(res => {
      let {total, list} = res.data
      if (total > this.data.list.length) {
        this.setData({list})
      } else {
        isLoading = false
        $service.showToast('到底啦！')
      }
    }).catch(err => {
      $service.showToast(err.msg)
    })
  },
  onReachBottom() {
    if (isLoading) {
      params.size = params.size + 10
      this.queryTransactionListPage()
    }
  }
})